

package myclass;

import java.util.ArrayList;
import java.util.List;
import javax.swing.SwingWorker;


public class BackgroundWorker extends SwingWorker<List<String>, String>
{
    private static final int COUNT = 100000; 
    List<String> list = new ArrayList<>();
    private OutputTable table;

    @Override
    protected List<String> doInBackground() throws Exception
    {
        for(int i = 0; i < 100000; i++){
            setProgress(getCurrentProgressInParcent(i));
            list.add(String.valueOf(i));
            Thread.sleep(500);
        }
         return list;
    }

    private int getCurrentProgressInParcent(int currentPosition){
        return currentPosition * 100 / COUNT;
    }
    
}
